package com.bootdo.wx.service.impl;

import com.bootdo.common.utils.PageHelperUtils;
import com.bootdo.wx.dao.CmsSlideDao;
import com.bootdo.wx.domain.CmsSlideDO;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bootdo.wx.dao.GoodsBargainDao;
import com.bootdo.wx.domain.GoodsBargainDO;
import com.bootdo.wx.service.GoodsBargainService;



@Service
public class GoodsBargainServiceImpl implements GoodsBargainService {
	@Autowired
	private GoodsBargainDao goodsBargainDao;
	@Autowired
	private CmsSlideDao cmsSlideDao;
	
	@Override
	public GoodsBargainDO get(String id){
		return goodsBargainDao.get(id);
	}
	
	@Override
	public List<GoodsBargainDO> list(Map<String, Object> map){
		return goodsBargainDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return goodsBargainDao.count(map);
	}
	
	@Override
	public int save(GoodsBargainDO goodsBargain){
		return goodsBargainDao.save(goodsBargain);
	}
	
	@Override
	public int update(GoodsBargainDO goodsBargain){
		return goodsBargainDao.update(goodsBargain);
	}
	
	@Override
	public int remove(String id){
		return goodsBargainDao.remove(id);
	}
	
	@Override
	public int batchRemove(String[] ids){
		return goodsBargainDao.batchRemove(ids);
	}

	@Override
	public PageInfo<Map<String,Object>> getBargainGoodsList(Map<String, Object> paramMap) {
		PageHelperUtils.page(paramMap);
		List<Map<String,Object>> list =goodsBargainDao.getBargainGoodsList(paramMap);
		PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(list);
		return pageInfo;
	}

	/*@Override
	public Map<String,Object> bargain() {
		Map<String,Object> map = new HashMap<String,Object>();
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("type", "3");
		List<CmsSlideDO> imgList = cmsSlideDao.queryAll(params);
		if (imgList.size() == 0) {
			map.put("img","0");
		} else {
			map.put("img",imgList.get(0));
		}
		params.put("pan","0");
		List<Map<String,Object>> goodsList = goodsBargainDao.getBargainGoodsList(params);
		map.put("goodsList",goodsList);
		return map;
	}*/

	/*后台查询9砍价列表*/
	@Override
	public List<Map<String,Object>> getBargainList(Map<String, Object> map) {
		return goodsBargainDao.getBargainList(map);
	}

	@Override
	public int getBargainListCount(Map<String, Object> map) {
		return goodsBargainDao.getBargainListCount(map);
	}
	
}
